1 /****************************** Module Header ******************************\
2 * Module Name: ServiceInstaller.h
3 * Project: CppWindowsService
4 * Copyright (c) Microsoft Corporation.
6 * The file declares functions that install and uninstall the service.
8 * This source is subject to the Microsoft Public License.
9 * See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
10 * All other rights reserved.
12 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
13 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
15 \***************************************************************************/
21 // FUNCTION: InstallService
23 // PURPOSE: Install the current application as a service to the local
24 // service control manager database.
27 // * pszServiceName - the name of the service to be installed
28 // * pszDisplayName - the display name of the service
29 // * dwStartType - the service start option. This parameter can be one of
30 // the following values: SERVICE_AUTO_START, SERVICE_BOOT_START,
31 // SERVICE_DEMAND_START, SERVICE_DISABLED, SERVICE_SYSTEM_START.
32 // * pszDependencies - a pointer to a double null-terminated array of null-
33 // separated names of services or load ordering groups that the system
34 // must start before this service.
35 // * pszAccount - the name of the account under which the service runs.
36 // * pszPassword - the password to the account name.
38 // NOTE: If the function fails to install the service, it prints the error
39 // in the standard output stream for users to diagnose the problem.
41 void InstallService(PWSTR pszServiceName
,
44 PWSTR pszDependencies
,
50 // FUNCTION: UninstallService
52 // PURPOSE: Stop and remove the service from the local service control
56 // * pszServiceName - the name of the service to be removed.
58 // NOTE: If the function fails to uninstall the service, it prints the
59 // error in the standard output stream for users to diagnose the problem.
61 void UninstallService(PWSTR pszServiceName
);